<?php
//
defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'main';
$this->model('model')->check_custom();
$this->model('model')->check_worker('',true);
if($_RQ['op']=='main'){
	$return['list']=array();
	set_html('title','客户列表');
	$return['params']=array('buystatus'=>0);
	exi($return);
}
// js 获取数据
if($_RQ['op']=='getlist'){	
	$params=array('merchid'=>$_SESSION['onemerchid'],'uniacid'=>$_SESSION['uniacid'],'follow_user_userid'=>$_SESSION['workeruserid']);
	$workerid=intval($_RQ['workerid']);
	if($workerid){
		$params['workerid']=$workerid;
		$return['params']['workerid']=$workerid;
	}
	$buystatus=intval($_RQ['buystatus']);
	$params['buystatus']=$buystatus;
	$return['params']['buystatus']=$buystatus;
	if($_RQ['userid']){
		$params['external_userid']=$_RQ['userid'];
		$return['params']['userid']=$_RQ['userid'];
	}
	$pindex = max(1, intval($_RQ['page']));
	$psize = 10;
	$total='';
	$list=pdo_getslice('jy_scrm_member',$params,array($pindex,$psize),$total,$fields,'','id desc');
	foreach($list as $k=>&$v){
		$v['buystatustitle']=$this->user_buystatus[$v['buystatus']];	
	}
	$return['user_buystatus']=$this->user_buystatus;
	$return['list']=$list;
	exi($return);
}
?>